<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    function shu(min,max){
        return Math.floor(Math.random()*(max-min+1))+min;
    }
    var newarr = [];
    for(var i = 1; i<=10;i++){
        var a = shu(1,100);
        //如果新数组里面没有a
        if(newarr.indexOf(a)==-1){
            //那么你就push进去
            newarr.push(a)
        }else{
            //如果新数组里面已经有过a这个数字，那么就让i-1，再重新循环一次
            i--;
        }
    }
    newarr.sort(function(a,b){
        return b-a;
    })
    console.log(newarr);
</script>